﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.CMS.ViewModels.AdAttributeEditViewModel>" %>
<%@ Import Namespace="ChoViet.Lib.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Sửa thuộc tính cho danh mục
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if (ViewData["MessageInfo"] == null)
  { %>
<% using (Html.BeginForm("EditCms", "AdAttribute", FormMethod.Post, new { id = "adminForm" }))
   {%>
    <%= Html.ValidationSummary(true)%>
    
    <fieldset>
        <legend>Sửa</legend>
        <font color="red">(*)</font> là trường bắt buộc phải nhập.
        <table class="admintable">
            <tbody>
                <tr>
                    <td class="key">
                        Chọn chuyên mục
                    </td>
                    <td>
                        <select id="CategoryId" name="CategoryId" style = "width:200px">
                            <option>-- Chọn chuyên mục --</option>
                            <%foreach (var item in Model.CategoryBuiltTree)
                              {
                                  var dis = "";
                                  var slt = "";
                                  if (item.Value == Model.AdAttribute.CateID.Value.ToString()) slt = "selected='selected'";
                                  if (Model.ParrentCatrgories.Where(e => e.ID == Convert.ToInt32(item.Value)).Count() > 0) dis = "disabled = 'disabled'"; 
                                  %>
                                  <option <%=dis%> value="<%=item.Value%>" <%=slt%>><%=item.Text%></option>                                
                              <%} %>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tên thuộc tính  (<font color="red">*</font>)
                    </td>
                    <td>
                        <%= Html.TextBoxFor(model => model.AdAttribute.Name, new { @class = "required" })%>
                    </td>
                </tr>                
                <tr>
                    <td class="key">
                        Mô tả
                    </td>
                    <td>
                        <%= Html.TextBoxFor(m => m.AdAttribute.Description)%>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Lưu lại" />
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <% }
  } %>
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();
        });
    </script>
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/AdAttribute/IndexCms/", "back")%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Sửa phân mục
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
<%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
